import QtQuick
import QtQuick.Controls

Window {
    width: 400
    height: 300
    visible: true
    title: qsTr("Slider - Style2")

    Column {
        anchors.centerIn: parent
        width: parent.width * 0.8
        spacing: 10

        Slider {
            id: slider
            width: parent.width
            from: 0
            to: 100
            value: 50
            stepSize: 10
            snapMode: Slider.SnapAlways
        }

        Item {
            width: parent.width
            height: 30

            Repeater {
                model: 11  // 0到100，每10一个刻度，共11个数字
                
                Column {
                    x: slider.leftPadding + index * ((slider.availableWidth) / 10) - width/2
                    spacing: 4

                    Rectangle {
                        anchors.horizontalCenter: parent.horizontalCenter
                        width: 2
                        height: 10
                        color: "#808080"
                    }

                    Text {
                        text: (index * 10).toString()
                        color: "#808080"
                        font.pixelSize: 12
                    }
                }
            }
        }
    }
}
